How long should a mattress last?

I’ve had my mattress about 10 years. The last couple of mornings, I’ve been waking up with lower back pain, which is not normal for me. I flip it regularly, but I wonder if its just worn out. How do you know when it’s time to replace it?