Once you bring it home, make sure you look after it  - regularly rotating the mattress helps distribute wear evenly and prevents sagging in certain areas. Using a mattress protector can also protect it from spills, dust, and allergens.
You can also influence the lifetime of the mattress by you or your partner's weight and sleeping habits. The heavier you are or the more frequently you move during sleep the more the mattress could experience wear and tear like sagging.