UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'rDhugMMyM4eCBXCpUVNKkp38ZqdqViuwuCqjpbVabYg='
WHERE
key_id = '224eec8bb3bb72aebee0fde3966582a51397fda865be86fcd2cce6530bcf1f11'
AND (
token = 'rDhugMMyM4eCBXCpUVNKkp38ZqdqViuwuCqjpbVabYg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)