$wpdb->query("UPDATE {$wpdb->posts}
SET menu_order := CASE
WHEN menu_order = {$post->menu_order}
THEN $position
ELSE menu_order + SIGN({$post->menu_order} - $position)
END
WHERE menu_order BETWEEN LEAST({$post->menu_order}, $position) AND GREATEST({$post->menu_order}, $position) AND post_parent = '{$post->post_parent}' AND post_author = '{$post->post_author}';");