UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+oGYgVboBjjn8v10rMQMzUNqbCultloFJ1PR5njR2Iw=' 
WHERE 
  key_id = '804801f8fe408ff9af30c39c45c4cc6322285cab79368ff7f76f9ce79d23e799' 
  AND (
    token = '+oGYgVboBjjn8v10rMQMzUNqbCultloFJ1PR5njR2Iw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047