Record locking mechanism?

Record locking mechanism?

I'm making an application that is essentially going to be a community queue where users grab individual records and when make a decision for it.

I need to make sure 2 users cannot open the same record at the same time. I'd like some kind of record locking mechanism that checks if someone else has a record open in which case the 2nd user would receive an error message saying the record is locked already.

Is this possible? Has anyone done this before?