UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kgbyCQV5GciCN2VqJBC0LHzWO20L3TmovBFMGeegOmE=' 
WHERE 
  key_id = '01ebdf4c5bb03a5e0c813415029f84d07e175f120ea789b8904392e6be23c10d' 
  AND (
    token = 'kgbyCQV5GciCN2VqJBC0LHzWO20L3TmovBFMGeegOmE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036