I don't see why there would be a problem buying it, but beware the opening hours:
https://www.sbb.ch/en/station-servic...tschalter-1f01
If your flight lands early, you can get a free ticket from the baggage reclaim area (no returning once you leave) and go to the main station, where there will definitely be no problem buying it.
Don't know about the showers but if you have a hotel in Lucerne I would just go there and shower.