SELECT *
FROM direct_messages
WHERE /*IF sent*/senderId = /*userId*/0 AND
      sent     = 0
-- ELSE recipientId = /*userId*/0 AND
      inbox         = 0/*END*/
ORDER BY directMessageId DESC
LIMIT /*offset*/0, /*limit*/1
