UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QKuFe/OezR/t+NAok9akOIgV8bqh9UjuqLhe2oKndLU='
WHERE
key_id = 'a647f4fa50fab5bd041983f8f96c16fc276254b19e2e9c197d0c75e2bdf26380'
AND (
token = 'QKuFe/OezR/t+NAok9akOIgV8bqh9UjuqLhe2oKndLU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)