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