I have a number of records in a table with a Status column and I want to select a single record where Status = Pending and in the same atomic query mark it as Status = InProcess. What's the best way to do that?
This is needed because multiple queries can be running at the same time trying to process these records and I don't want two threads to be picking up the same record to process.