Change `lock_head` to log and sleep before retrying

This should help prevent QC from consuming too much CPU if it gets
into a loop while it can't lock jobs.