Picking up an object and dropping it with the same keycode

I have a box in my scene which I can pick up by pressing E and dropping it by clicking the mouse. However I want to be able to click to pick the object up and click again to drop it.

void Update ()
	{
		if (Input.GetKeyDown (KeyCode.Mouse0)) {
			if (Physics.Raycast (TransformCamera.position, TransformCamera.forward, out hit, 3f, RayMask)) {
				if (hit.transform.tag == "PickableObject") 
				
				{
					SetNewTransform (hit.transform);
				}
			}
		}

		if (Input.GetKeyDown (KeyCode.Mouse0)) 
		{
			RemoveTransform();
		}

Does anybody know how I can do this?

Just set a boolean

bool isSelected = false;

if (isSelected)
{
    RemoveTransform();
    isSelected = false;
}
else
{
    SetNewTransform(hit.transform);
    isSelected = true;
}