Stiffness in the back is a very common complaint, and fortunately it is rarely serious in someone your age. As you have already identified, it is likely that a combination of posture and your mattress and position while sleeping is the major problem. Another contributor could be what you do for work during the day, for example people who work at a computer all day long often have tension and soreness in the upper back.
I would recommend a combination of exercise and stretching exercises to improve the strength of your back muscles as well as working on your posture. This is probably especially important during the day, and you should make sure that you are using good posture while working at a computer, lifting heavy objects, etc. There are numerous sites on the internet where you can find lists of daily back exercises that can help you.
If you experience severe or worsening pain, if you have any
numbness or tingling in your hands or feet, if you have any weakness of the arms or legs, or if you have any problems with bowel or bladder control then this could indicate that your back pain may be a more serious problem and you should see your
primary care doctor immediately.