Q:

MySQL Update only if table contains value

I have a table which contains tasks, which should be executed at a certain time. For execution the job gets marked by the executor with its workerID. 
With next sql:
UPDATE table1.jobs
SET workerID=10
WHERE workerID IS NULL and time < NOW()
ORDER BY time LIMIT 1

I can mark the oldest not marked job.
Now I want this to be executed only if there is not already a job marked with workerID 10. 
Is this possible within one query?

A:

You can make worker_id as Unique key and you are done.
If workerID 10 is already there in your table your UPDATE  query will never execute.

