UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'c451VPmYmfZRxhEfyFNv7QKwgIhpDacbWr6D51z4GqE='
WHERE
key_id = '9d52f3aa4acb4e70444c05f8cfc62d5e03557866304603b48f9d649ff7abc0f8'
AND (
token = 'c451VPmYmfZRxhEfyFNv7QKwgIhpDacbWr6D51z4GqE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)