MySQL - UUID/created_at cursor based pagination?
WHERE   created_at &lt;= x
  AND ( created_at &lt; x OR uuid &lt; y )
ORDER BY created_at DESC,
         uuid       DESC


or this equivalent:

WHERE (     created_at &lt; x
       OR ( created_at = x AND uuid &lt; y )
      )
ORDER BY created_at DESC,
         uuid       DESC


This technique works for any pair of columns where the first one (created_at) could have duplicates and the second is unique (uuid or id).

And this is required:

INDEX(created_at, uuid)


Note that both parts of the WHERE are DESC.  Mixing ASC and DESC will defeat the usability of the INDEX.  (MySQL 8.0 can work around that.)

Note also, that this assumes you don't care what order the rows are in when created_at is duplicated, but you do want a consistent ordering.  Note that uuid will be seemingly random, but still consistent.  With that said, id (with or without Galera) and uuid work equally well.

(UUIDs suck, but that is a different discussion.)

More on pagination without using OFFSET .