How do I make a object rotate to just X=20 if Lshift is pressed

and then go back to X=90 if Lshift is released?

if(Input.GetKeyDown(KeyCode.LeftShift) {

transform.rotation = Quaternion.Euler(20,0,0);

else

transform.rotation = Quaternion.Euler(90,0,0);

Mark question as solved by this answer, if it solves your problem.