How to use a custom body_class as a condition?

You can try this,

$body_css_classes = get_body_class();

if ( in_array( 'my-class', $body_css_classes ) ) {
     /* DO THIS */
} else {
     /* DO THAT */
}    

For more details please check this.

tech