I'm not sure if there is a simpler way, but I would do it as,
Query database to find current stock (I guess your displaying this and other data about the part)
Make sure you keep the key to the row. If you don't want it to be displayed put it in a hidden input field.
When the user clicks the button, re-query the database (they may have been sitting there for an hour on the screen while another user has used a part already) and get the current stock.
Reduce the local stock variable by 1 "$stock -= 1"
Update the database with the new value, "UPDATE partsTable SET stock = '$stock' WHERE tableKey = '$key'".