If you leave then they're no longer paying you, so you owe them nothing, right? :)
Like another person said, there are people who enjoy modernizing codebases (I sometimes do myself), but if you are hating your job, do everyone a favor and make a change.
You should probably start with your manager, and explain why you are considering leaving.