The rules around this vary state by state. In states like CA, it's unfortunately illegal to sell glasses/contacts to someone with an expired prescription.
More info on buying glasses/contacts: https://www.consumer.ftc.gov/articles/buying-prescription-gl...