UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'V6o2lWoOr/zDf4qBF3DwESpkUPMkwVwbkh40QUN37nU=' 
WHERE 
  key_id = 'c478aa3b89acce9d3b585c242af4903c1b71eff8bb310792cf5cb01b114621f4' 
  AND (
    token = 'V6o2lWoOr/zDf4qBF3DwESpkUPMkwVwbkh40QUN37nU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036