look at a target only on X and Y axis with limitations

hey guys , someone please tell me how can i look at a target on 2 axis but clamp the the object’s rotation ,to only rotate from -45 to 45 on x and -60 to 60 on y axis.
also need the looking process to be smooth and use some kinda looking speed variable
i used this script to look at target and clamp the rotation, but it’s not working right ):

 void Update()
    {
        Quaternion OriginalRot = transform.rotation;
        transform.LookAt(target);
        Quaternion NewRot = transform.rotation;
        transform.rotation = OriginalRot;
        transform.rotation = Quaternion.Lerp(transform.rotation, NewRot, speed * Time.deltaTime);



       transform.eulerAngles = new Vector3(Mathf.Clamp(transform.eulerAngles.y, minimumX, 
                            minimumX), Mathf.Clamp(transform.eulerAngles.y, minimumY, maximumY), 0);

}

thanks

This is a method I use in an FPS controller to limit the X Axis (Up and down)

Quaternion ClampRotationAroundXAxis(Quaternion q)
    {
        q.x /= q.w;
        q.y /= q.w;
        q.z /= q.w;
        q.w = 1.0f;

        float angleX = 2.0f * Mathf.Rad2Deg * Mathf.Atan(q.x);

        angleX = Mathf.Clamp(angleX, -90f, 90f);

        q.x = Mathf.Tan(0.5f * Mathf.Deg2Rad * angleX);

        return q;
}

That should get you on the right track.