Timer for how long button is not pressed
I would start a timer when the button changes state. Then you timeout if
the button is released and it hasn't changed state for too long:

void loop()
{
    static int lastButtonState;
    static unsigned long buttonChangeTime;
    int buttonState = digitalRead(buttonPin);
    unsigned long now = millis();

    // Record time when button changes state.
    if (buttonState != lastButtonState)
        buttonChangeTime = now;

    // Timeout if button is not pushed for too long.
    if (buttonState == LOW &amp;&amp; now - buttonChangeTime &gt;= interval)
        Serial.println("Timeout.");

    lastButtonState = buttonState;
}


Don't forget to update lastButtonState on each iteration.