SELECT id,status
  FROM requestinfo
 WHERE id IN
       (SELECT requestinf0_.id
          FROM (SELECT requestinf1_.id
                  FROM requestinfo requestinf1_
                 WHERE (requestinf1_.status = 'QUEUED' OR
                       requestinf1_.status = 'RETRYING')
                   AND requestinf1_.timestamp < sysdate
                   AND (requestinf1_.owner = 'fca-executor' or owner is null)
                 ORDER BY requestinf1_.priority DESC) requestinf0_
         WHERE rownum <= 1)
   FOR UPDATE;