UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'GaB7hR/pC76MqXpjAO4wY4gvk5vuCQGryBh8CbuQr+0='
WHERE
key_id = 'fdc417de1f9fc1aa21bf17f1291eaa448225a522610e3f272b118e3f78f2780a'
AND (
token = 'GaB7hR/pC76MqXpjAO4wY4gvk5vuCQGryBh8CbuQr+0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)