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