So, looking at these queries, it seems that you want all enabled rows from the mass_scan_lists table, but the only difference is the ordering. You want all urgent to come first, ordered byupdated_at descand then havenon-urgentordered byupdated_at`.

So, I would just use some custom SQL in the order statement. You don't specify what RDBMS you are using, but if it is PostgreSQL, it would look like: