MySQL queries to select messages related to a user, using UNION vs. OR
OR is really bad in Joins, in WHERE it can/should be replaced when the optimizer doesn't use indexes (and OR does).

I would prefer the Union for a simple reason, it's easier to write/understand/extend. Additionally the first two Selects are the same besides one condition, so combining them is simple.

And using aliases really simplifies reading the code.

  (SELECT dm.*
   FROM `direct_message`AS dm
   INNER JOIN direct_message_thread AS dmt
      ON dmt.chat_id = dm.id
     AND dmt.school_id = dm.school_id -- moved from WHERE as this is a join condition 
   WHERE (dm.recipient_id = '10896' OR dm.creator_id = '10896')
     AND dm.school_id = '1'
   GROUP BY dm.id
   ORDER BY dmt.inserted DESC)

UNION ALL

  (SELECT dm.*
   FROM `direct_message` AS dm
   INNER JOIN direct_message_thread AS dmt
      ON dmt.chat_id = dm.id
     AND dmt.school_id = dm.school_id
   INNER JOIN direct_message_group AS dmg
      ON dmg.chat_id = dm.id
   WHERE dmg.staff_id = '10896'
     AND dm.school_id = '1'
   GROUP BY dm.id
   ORDER BY dmt.inserted DESC)