How to get all non deleted messages from one user
AND has higher precedence than OR. Your condition is parsed and executed as:

    WHERE (msg.sender_user_id = 2) 
       OR ( rcp.user_id = 2
        AND msg.deleted = 0 
        AND rcp.deleted = 0
          )


Perhaps you mean to write:

    WHERE (msg.sender_user_id = 2 OR rcp.user_id = 2)
      AND msg.deleted = 0 
      AND rcp.deleted = 0