A good RDBMS will have atomicity with its transactions. The issue here is your table design is too limited for your job queue to work. Change your job_done boolean into a multi-status tinyint value of ...