Optimize uniqueByOwner job query, delete old failed jobs