Best way to limit rotation

I need little (huge) help with rotation of my blasters.
I want them to be locked on Z axis at all, limit X axis from 340 to 20, and add some limitation on Y.

I know there are alot topics on this, but i just cant figure it out.
I tried some clamping, eulers,… without bigger success.

I would be thankful for any help.

Video description here:


Csharp script here:

using UnityEngine;
using System.Collections;

public class Blaster : MonoBehaviour 
	public TargetingSystem targetingSystem; //access to target
	public Transform target; //selectedTarget
	private Transform myTransform;

	public float rotationSpeed; //how fast our blaster targeting
	private Quaternion wantedRotation; //what rotation we need for hit our target

	// Use this for initialization
	void Start () 
		myTransform = transform;

	// Update is called once per frame
	void Update () {

		GetTarget ();
		FocusOurTarget ();


	void GetTarget()
		if (targetingSystem.selectedTarget != null) //if we have target
			target = targetingSystem.selectedTarget; // select him
		else //if we dont have target
			target = null; //empty target

	void FocusOurTarget()
		if (target != null) //if we have target
			wantedRotation = Quaternion.LookRotation(target.position - myTransform.position); //calculate rotation for hit
			myTransform.rotation = (Quaternion.RotateTowards(myTransform.rotation, wantedRotation, Time.deltaTime * rotationSpeed)); //rotate blaster for hit

			myTransform.rotation = (Quaternion.RotateTowards(myTransform.rotation,targetingSystem.transform.rotation, Time.deltaTime * rotationSpeed)); //if we dont have target rotate forward

This is the most common way for beginners to clamp numbers, and it works well.

    // Limit x
    if(transform.eulerAngles.x > 340)
        transform.eulerAngles.x = 340;
    if(transform.eulerAngles.x < 20)
        transform.eulerAngles.x = 20;
    // Limit y
    if(transform.eulerAngles.y > someNumber)
        transform.eulerAngles.y = someNumber;
    if(transform.eulerAngles.y < someOtherNumber)
        transform.eulerAngles.y = someOtherNumber;

But if you want to look fancy, and make your code easier to read, do this:

    // Get
    float rotX = transform.eulerAngles.x;
    float rotY = transform.eulerAngles.y;
    float rotZ = transform.eulerAngles.z;
    // Clamp		
    rotX = Mathf.Clamp (rotX , 20, 340);
    rotY = Mathf.Clamp (rotY , someOtherNumber, someNumber);
    // Set		
    transform.eulerAngles = new Vector3(rotX, rotY,rotZ);