You have multiple worker processes/threads pulling records, FIFO, from a table. If one worker 'dies' or fails processing, another worker should retry the same record.
Here are some ideas (partially tested).
-- find first record & select it, taking exclusive lock
SELECT * FROM q WHERE id = (SELECT @id := MIN(id) FROM q) FOR UPDATE;
-- now other threads need to see that it's deleted (new MIN())
-- This only works where reading session is in READ UNCOMMITTED mode!
DELETE FROM q WHERE id = @id;
-- ... do whatever processing is required...
-- then either COMMIT (if successful)
-- or ROLLBACK (if processing failed and another worker should attempt)