UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'FRf7Ltd0KRBmKCKXtucYbDS9iXQwJXtWeRZYBEctSqU='
WHERE
key_id = '651cef175d9ccfecb4cd5a4fed9cfe46b50747474c951be3da9e88fc684ef47c'
AND (
token = 'FRf7Ltd0KRBmKCKXtucYbDS9iXQwJXtWeRZYBEctSqU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)