You can upgrade from 4.2.3 to 4.5 directly. Read the 4.5 release notes - https://moodledev.io/general/releases/4.5
If you want to transfer the site to a new server then there's nothing to stop you transferring the database and the 'moodledata' files and then upgrading them to 4.5. There's no need to get the 4.2.3 version running.
The only reason to get a new version of 4.5 installed would be to confirm that it will run at all on your new server. That's not an entirely ridiculous thing to do.
If you want to transfer the site to a new server then there's nothing to stop you transferring the database and the 'moodledata' files and then upgrading them to 4.5. There's no need to get the 4.2.3 version running.
The only reason to get a new version of 4.5 installed would be to confirm that it will run at all on your new server. That's not an entirely ridiculous thing to do.