SELECT A.id, A.name
FROM couriers A
LEFT JOIN (SELECT rc.id, rc.courier_id
FROM region_couriers rc
JOIN regions r
ON rc.region_id = r.id
WHERE rc.return_date <= DATE_ADD(CURRENT_TIMESTAMP,INTERVAL -r.days_in_transit DAY)) B
ON A.id = B.courier_id
WHERE B.courier_id IS NULL