SELECT `post_id` FROM `posts` WHERE `author_id` IN (:id1, :id2, :id3)
SELECT `p1`.`post_id`
FROM `posts` AS `p1`
JOIN `posts` AS `p2`
ON `p2`.`post_id` = `p1`.`post_id` AND `p2`.`author_id` = :id2
JOIN `posts` AS `p3`
ON `p3`.`post_id` = `p1`.`post_id` AND `p3`.`author_id` = :id3
WHERE `p1`.`author_id` = :id1
SET @id := 0;
UPDATE `mail`
SET `status` = `sending`
WHERE (@id := `id`) AND `status` = 'awaits'
ORDER BY `id`
LIMIT 1;
SELECT * FROM `mail` WHERE `id` = @id;