Running
Model::where('status', 'pending')->chunk(200, ...) and updating status to 'processed' inside the callback silently skips half your rows because OFFSET shifts as rows leave the filter. Switching to chunkById(200) paginates by id > $lastId so every row gets…