id, created
user_id
dialog_id
SELECT `d1`.`dialog_id`
FROM `dialog_users` AS `d1`
JOIN `dialog_users` AS `d2` ON `d2`.`dialog_id` =`d1`.`dialog_id`
JOIN (SELECT `dialog_id`, COUNT(*) AS `count`
FROM `dialog_users`
GROUP BY `dialog_id`)
AS `c` ON `c`.`dialog_id` = `d1`.`dialog_id`
WHERE `d1`.`user_id` = :user1
AND `d2`.`user_id` = :user2
AND `c`.`count` = 2