I need help creating an index for timestamp
First, you need to make your query SARGable. Fortunately, in your case, that is simple.

SELECT date_provided as d,available as a 
FROM parking_data 
WHERE code = 'E03' 
AND date_provided &gt; NOW() - INTERVAL '20' HOUR


Your version of the query required the optimizer to add 20 hours to every record's date_provided, and then compare each to the value provided by NOW(). This new version of your query modifies NOW() by 20 hours, and so can use an index to find exactly where the records start that have that timestamp.

If your query is still too slow, you can add a composite index.

ALTER TABLE parking_data
ADD INDEX (`code`,`date_provided`)


This should yield extremely quick results.

You can also drop the single column index on code if you add this index, as that single column index will be redundant at that point.