Slow query while selecting a higher offset from millions of rows
You're seeing the intrinsic drawback of OFFSET pagination. Using LIMIT, you force your DB to sort all the records and count them all the way up to your OFFSET base. 

Keyset pagination may correspond more closely to your actual needs here and will yield much better performance. As described in the above linked article, simply paginate based on the last key you've seen:

SELECT * 
FROM securityData 
WHERE id &gt; ?last_seen_id
ORDER BY log_time 
LIMIT 50;


This allows your DB to leverage the index over id to directly jump to the first relevant row instead of going through all 5000753 rows preceeding it.