UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'uBhscEAXYIxNNU7VldSXNFQriG1MjCsz+jm95CetZjA='
WHERE
key_id = 'aa0d3ceedc42973e46169a45ba2d1ecc03acb8eef1838c92a901e63ca5033818'
AND (
token = 'uBhscEAXYIxNNU7VldSXNFQriG1MjCsz+jm95CetZjA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)