(
    SELECT b.*
    FROM users       AS a,
         friendships AS b
    WHERE a.userId      = b.passiveId AND
          a.remove      = false AND
          a.protect     = true AND
          b.activeId    = /*activeId*/0 AND
          b.accept      = true AND
          b.removedTime = 0
    ORDER BY passiveId
) UNION ALL (
    SELECT b.*
    FROM users       AS a,
         friendships AS b
    WHERE a.userId      = b.passiveId AND
          a.remove      = false AND
          a.protect     = false AND
          b.activeId    = /*activeId*/0 AND
          b.removedTime = 0
    ORDER BY passiveId
)
ORDER BY passiveId
LIMIT /*offset*/0, /*limit*/1
