It purely dependent of storage condition of cement.
If its protected from water, humid air etc, it can last longer than the expiry.
Expiry is generally consider as 3 month from the manufacturing week.
It is always better to physically check for lumps in cement and any sign of hydration process, before using.
If cement is stored for longer time, it can be used in no structural works where strength requirement is not a big criteria.
For structural purpose, it is always better to get the cement tested from 3rd party lab and base on its 3 days strength, estimated its ultimate strength at 28 days.
3 Days is generally 50% of its characteristic strength.