I am creating a competition page and have a ticket table in mysql. Each ticket contains an availability column which is either '1' or '0' (true or false).
When the user adds a ticket to their basket I am setting the value to 0 so that other users cant attempt to buy that ticket while it is being purchased by someone else. I am wanting a timeout so that the value will essentially set back to 1 after x amount of time (let's say 10 minutes)
I get how to do all aspects except this timer. I have seen something about events but I am not sure how to use them.
Pseudocode for what I want
adding to basket
availability = 0
trigger timer event
after 10 mins
if purchased = 0
availability = 1
(I am mainly controlling the site with PHP)