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