my codes are not working

these are my key and door codes. if you look at my key codes there is Door.keyfound = true; but it doesnt affect the keyfound variable in my door code. idk why can someone explain

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class keyScript : MonoBehaviour
{
public GameObject presstoequip, key;

void OnTriggerStay(Collider other)
{
    if (other.CompareTag("MainCamera"))
    {
        presstoequip.SetActive(true);
        if (Input.GetKey(KeyCode.F))
        {
            key.SetActive(false);
            Door.keyfound = true;
            presstoequip.SetActive(false);
        }
    }
}
void OnTriggerExit(Collider other)
{
    if (other.CompareTag("MainCamera"))
    {
        presstoequip.SetActive(false);
    }
}

}

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Door : MonoBehaviour
{
public GameObject door_closed, door_opened, intText, lockedtext, crosshair;
public AudioSource open, close;
public bool opened, locked;
public static bool keyfound;

void Start()
{
    keyfound = false;
}
void OnTriggerStay(Collider other)
{
    if (other.CompareTag("MainCamera"))
    {
        if (opened == false){
            if(locked == false)
            {
            intText.SetActive(true);
                if (Input.GetKey(KeyCode.E))
                {
                    door_closed.SetActive(false);
                    door_opened.SetActive(true);
                    intText.SetActive(false);
                    //open.Play();
                    StartCoroutine(repeat());
                    opened = true;
                }  
            }
            if (locked == true)
            {
                lockedtext.SetActive(true);
                crosshair.SetActive(false);
            }
        }
    }
}
void OnTriggerExit(Collider other)
{
    if (other.CompareTag("MainCamera"))
    {
        intText.SetActive(false);
        lockedtext.SetActive(false);
        crosshair.SetActive(true) ;
    }
}
IEnumerator repeat()
{
    yield return new WaitForSeconds(3.0f);
    opened = false;
    door_closed.SetActive(true);
    door_opened.SetActive(false);
    //close.play();
}
void update()
{
    if (keyfound == true)
    {
        locked = false;
    }
}

}

That sounds like you wrote a bug… and that means… time to start debugging!

By debugging you can find out exactly what your program is doing so you can fix it.

Use the above techniques to get the information you need in order to reason about what the problem is.

You can also use Debug.Log(...); statements to find out if any of your code is even running. Don’t assume it is.

Once you understand what the problem is, you may begin to reason about a solution to the problem.