UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'W5BEmEtG5v0kASl9MwfnqZzBqJkPTm9QPB3EKQM27ww='
WHERE
key_id = '7f21812a3a17f125f823dc2f9c2ab43cc12513965d42b45d20d9ecbda9c527d4'
AND (
token = 'W5BEmEtG5v0kASl9MwfnqZzBqJkPTm9QPB3EKQM27ww='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)