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