Only Use one Key Press One

Hi! Im making a game and I only want the player to be able to click “a” and “d” one and then not be able to move any more in that direction! Here is the movement code I have so far.

    private float movementSpeed = 7f;
    private float movementSpeed1 = -7f;

    void Start()
    {

    }

    void Update()
    {
        float horizontalInput = Input.GetAxis("Horizontal");
        if (Input.GetKeyDown("d"))
        {
            transform.position = transform.position + new Vector3(movementSpeed * Time.deltaTime, horizontalInput * movementSpeed * Time.deltaTime, 0);

        }
        if (Input.GetKeyDown("a"))
        {
            transform.position = transform.position + new Vector3(movementSpeed1 * Time.deltaTime, horizontalInput * movementSpeed1 * Time.deltaTime, 0);

        }
    }

Just have a variable keep track of whether or not they’ve pressed that key, and set it to true when it is pressed.

Thanks!