UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'fvJaiEoNeoiLPHfGdrxM5RAznV0SwlWleNlXHSN8V+A='
WHERE
key_id = 'a31e3c020c836f4f48886b6f0f6e0fecc90e3f394a0b80576d1db6a7194c3497'
AND (
token = 'fvJaiEoNeoiLPHfGdrxM5RAznV0SwlWleNlXHSN8V+A='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)