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