UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '992VjFO0FhUD57XdyTJSapoEBWpZAxzFpTlzNcWj4uc='
WHERE
key_id = '8d6e09bc763a2c2120d5538bdfe37d2873ee0dc55e5f5366640825020d3e4a0a'
AND (
token = '992VjFO0FhUD57XdyTJSapoEBWpZAxzFpTlzNcWj4uc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)