Safe Extremum Seeking with Applications to Particle Accelerators