UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'S0HqUCVBRH3e11v1zMd8qeeyfx8t26odYrsMdQHNoXc='
WHERE
key_id = 'b1474f6795366a85bee60cdf244bc41d81f70a0dbf27d881b23c686e20e2a7e5'
AND (
token = 'S0HqUCVBRH3e11v1zMd8qeeyfx8t26odYrsMdQHNoXc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)