UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KYmzbED59BZTDVtR8XyDHU9XqOLoQPhhko2oswXpZG0='
WHERE
key_id = '519266750882e0c9c9286e812a294497b94985a5aae7297d90ca6a64e0d355cc'
AND (
token = 'KYmzbED59BZTDVtR8XyDHU9XqOLoQPhhko2oswXpZG0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)