May or may not be suitable for your needs but you can use the general sibling selector in Sass/CSS. This will select all elements on the same node level (not explicitly before but still handy):
.second {
.first ~ & {
/* styles to be applied to .second if a .first exists at the same node level */
}
}