Deux ans is the duration: two years.
Together, they tell you how long the validity lasts.
Because it is a duration expression, there is no article before deux ans.
Both ans and années can mean years, but ans is the more usual word in straightforward counting or duration expressions.
So with a simple time length, French normally says:
Années is often used when the speaker wants to emphasize the span of time, describe the years more fully, or speak in a more literary or expressive way.
For this sentence, deux ans is the normal and natural choice.
Yes. A few natural alternatives are:
The original sentence is correct, but in some contexts la durée de validité may sound a little more explicit.
It is correct and fairly neutral, but it can sound a bit administrative or formal, especially in official contexts like:
In everyday conversation, French speakers might more often say something like:
depending on what is being described.