People who have already had shingles can get the shingles vaccination as a way of preventing future bouts of shingles, as the Centers for Disease Control and Prevention recommends. Someone with active shingles should let the rash subside before being vaccinated; no other restrictions exist regarding when to be vaccinated.
The shingles vaccine is approved for people 50 and over, but isn't recommended until the age of 60, as Mayo Clinic points out. While it's still possible to contract shingles after the vaccination, being vaccinated should reduce the severity of any shingles attack. Some people also develop a temporary rash similar to that of chicken pox after vaccination.