Suppose $x$ is a chosen class in the singular cohomology (integer coefficients) of a space $X$. I'm thinking primarily of classes of odd degree on a simply connected space. What are necessary conditions (besides $x^2=0$) for the existence of a cocycle representing $x$ whose cup-square equals zero as a cocycle? Sufficient conditions?

Take your pick of the precise form of the question: you can fix a cochain model for cup products before or after choosing $x$, or even allow a DGA quasi-isomorphic to the singular cochains on $X$.

You may feel inclined to mutter "Steenrod square" or "Massey product" - but which, and why?