My hamsters have travelled a fair bit in the past and I usually find that they'll sleep for most of the journey any way.
It's generally safer for a hamster to travel in a carrier as opposed to a cage as there's less space for them to be thrown around in if you need to brake suddenly. There's also less risk of things in the cage falling on them in a carrier. I tend to use a carrier similar to this if I'm travelling with just one of my hamsters:
https://www.amazon.co.uk/Ferplast-Al.../dp/B00F5ZYR72
It's worth keeping some used substrate to put in the carrier and I usually put a cardboard box or something that they can use as a hide inside too. You'll also need some large chunks of cucumber for moisture during the journey and it's worth putting some food and something for them to chew in there as well.
A tip that was given to me is to bring one of those fabric bags for life that will fit the carrier inside so that you can pop the carrier inside it to take your hamster inside with you when you stop rather than leaving them in a cold car.
During the night, you can just pop your hamster back in their cage once you're in the hotel room or wherever you're stopped.