How to select from table by comparing multiple rows with same key
Assuming only two possible values for status , eliminate all keys that has more than one row and filter for failed status

SELECT *
FROM key_status
WHERE status='FAILED'
  AND key &lt;&gt;
    (SELECT key
     FROM key_status
     --WHERE status IN('COMPLETED','FAILED') 
     GROUP BY key
     HAVING COUNT(key) &gt;1)