I have following use case:
My table (significant parts):
CREATE TABLE transfers (
    id int,
    product_id int,
    source_location_id int,
    destination_location_id int,
    quantity int,
    created_at datetime
);
Now my query is:
SELECT * 
FROM transfers 
WHERE (source_location_id = 123 OR destination_location_id = 123)
ORDER BY created_at DESC
LIMIT 100 OFFSET 400
At the moment that table contains 20 million rows and this query takes 2-3 minutes to finish)
Is there a way to create an index for that OR clause since this specific id will always be the same for both locations in that SELECT.
I have seen some people mentioning unions for OR clause, but I am using an ORM that does not support UNIONS nor SUBQUERIES, plus unions will not work with pagination.