Spontaneous symmetry breaking in a waveguide with periodic complex potential