Use a consistent sort column and a parameterized cursor when paging results.
-- Bind :last_id as a parameter (use 0 for the first page). SELECT id, title, created_at FROM posts WHERE id > :last_id ORDER BY id ASC LIMIT 20;