Order by createdAt if priority is the same