UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'S9rSosrEm4LEDgFHqeMW57xjTUkz7O2WPKBKEIFKdjs='
WHERE
key_id = 'f0f9f128a1cf777aec132eeef77d7b42e326ec3e3b940a36df64993862ea781b'
AND (
token = 'S9rSosrEm4LEDgFHqeMW57xjTUkz7O2WPKBKEIFKdjs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)