UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'U+dS1V7uL1iQMh2qScBjjsXsNXEPsqHEMYjsLbqPuxQ='
WHERE
key_id = 'ed4410afe5afbf8ae188eda321bdc380342dfd517b3f2c448dab56eff8586c71'
AND (
token = 'U+dS1V7uL1iQMh2qScBjjsXsNXEPsqHEMYjsLbqPuxQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)