Sure,
you could set the time in a session, then when they submit, subtract that value from the new time (which you calculate when the submit is received) then act accordingly depending on the result.
However, I see a problem with what you're trying to do. If a user spends say 30 minutes shopping on your site, how are you going to handle that? Lets say they have 7 things in their cart, each bought at a different time, then if you time limit the result, and three things are too old, while the remainder are ok, then what do you do?
It would be tricky to take the things that are too old out and leave the rest (I mean, that's easy, but what are you going to say to the user? "Sorry you were too slow to buy three of the seven items you want!")
hope this helps
/s