You currently cannot specify conditions when querying records in scripting. You must get all the records and then filter the result in JavaScript.
const table = base.getTable("myTableName")
const fieldName = "color"
const queryResult = await table.selectRecordsAsync({fields: [fieldName]})
const greenRecords = queryResult.records.filter(record => (
record.getCellValueAsString(fieldName) == "green"
))
console.log(greenRecords)