Basically you have status = 0,1,2 for queued, processing, done. You have a filtering CTE that returns the queued rows, sort by id and update status = status +1 of the top one.
You can even get fancy and disallow updates on the status column for other users to make it immutable.
I've done this in SQL server in a very similar way to as explained in the post