Optimal control of state-constrained unstable systems of elliptic type