Join query with closest date in "ON" clause
Let's jump "out of the box"...

Have a column in the first table with the datetime rounded to the minute.  (One minute being your resolution.)

Have two columns in the second table, both datetime, one rounded up to the next minute, the other down.

Index both columns in second table:  (id, lower) and (id, upper).

Now run a UNION ALL of two SELECTs, one JOINing the first table to the second via id and lower, with equality; the other via id and upper.

This could catch pairs that are almost 2 minutes apart, so in the outer part of the UNION, do a WHERE to filter using the to-the-second columns -- checking which ones match within one minute.

This technique is likely to be much faster than any other.