I believe your if statement is incorrect it should be an AND (&&
) not OR
so try
if ( ! is_user_logged_in() && ! is_page( 'lost-password' ) ) {
EDIT
Try using $object = get_queried_object()
for checking the post slug
$object = get_queried_object();
if ( ! is_user_logged_in() && ( ! $object || 'my-account' !== $object->post_name ) ) {
// ...
EDIT 2 The page slug was wrong so updated in the second example