would it be better to remove the temporary table and update the actual table real-time?
No. If you do this and your connection breaks, you could be left with an empty mytable until you reconnect and complete the update.
which can take 3 hours
Which part is taking the longest? Just how much data are you updating?
I have tackled this issue in 2 different ways, depending on the situation: A) Rename mytable to mytable_old and mytable_temp to mytable
B) Instead of deleting all the data from mytable and copying from mytable_temp, do it in chunks. (This works only if there is a close relationship between the new/old data.) In other words, let's say there is a ProductID field: DELETE mytable WHERE ProductID BETWEEN 1 AND 10000
INSERT mytable SELECT * FROM mytable_temp WHERE ProductID BETWEEN 1 AND 10000