A good work environment is important, but so is the moolah. If you have specialized skills and you think you are underpaid, then go where the money is. Take a risk, if the environment in the new place is not good, move on. Since you've specialized skills, you won't have much problems in getting a good job.
If you are doing a job that you think anybody else can do without much effort, and you have been working in a nice cozy environment for several years now, it makes all the more sense to kick yourself out of your comfort zone. Upgrade your skills and look for a better paying job.
In this fast paced world, no jobs are guaranteed.