UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '12YDPOy5VE483rwba9OcjHCo3CcV+mcPxltNUeCHvzk='
WHERE
key_id = '9975a7174b34cfa26f08fb27ffd17957d76ebce5fc4b51261c78143ebe550a9e'
AND (
token = '12YDPOy5VE483rwba9OcjHCo3CcV+mcPxltNUeCHvzk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)