Yes. SPF 30 provides a high level of protection when it is applied correctly and reapplied as directed. SPF 50 offers very high protection, but neither sunscreen blocks every UV ray.
The most important sunscreen is one you will use properly and consistently. If you prefer the feel, finish or price of an SPF 30 product, using it generously every day is likely to provide better protection than applying a small amount of SPF 50.
Sunscreen is also only one part of a complete sun-protection routine. When UV levels are high, combine sunscreen with protective clothing, a broad-brimmed hat, sunglasses, shade and avoiding direct sun where possible.