Can "When" like keyword be used in scripted pipeline?
A Scripted Pipeline is literally a Groovy script, so you can just use if/else conditionals like you would in a normal Groovy script.

if (env.BRANCH_NAME == 'master') {
  // do steps here
} else {
  // do other steps here
}