UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aFgSv8M0y74rGwNzxLWGN9C+gjfA8m5uI1nXFxi014M='
WHERE
key_id = '0c7258143fe4b762d62a1cd37c7cc406a60528b2afdcd10e1effae95d1b959cb'
AND (
token = 'aFgSv8M0y74rGwNzxLWGN9C+gjfA8m5uI1nXFxi014M='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)