If you're in a situation where there's a good possibility where there will be two users trying to do something, outright locking will annoy people.
You can be a lot more clever, storing locks in a database, having the client poll in from the form to let the system know it's still connected, alert other users trying to access the page (by reading the database) and you could even add a notification system so users could click "notify me when I can submit" that stores their session key in another table with a reference to the lock...
Their client keeps polling for notifications and when the lock finishes or expires, you either let them know they can get a lock or automatically give them a lock.
Whatever you do, don't just add some code in that stops the form being processed. It'll make people monstrously unhappy.