It really depends on how you design your store.
There are different solutions that you can put in place for this
a) A 'holding' table, that reserves stock items until purchase is made or a timeout occurs
b) Using Session variables to store details of quantities of items in your cart. The quantity shown to the user then subtracts the Session Variable from the the quantity in the database. This solution will only work for the current user though - on another machine or browser session the quantities won't take into account whats in their basket.