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