UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8ko/R5uFxF87EHyUwkFkfTnmCurpppRHF2CivM1niME=' 
WHERE 
  key_id = '32bdacab311e061969a8588245e895785f6b4b774f48c5892449f674a33ce0aa' 
  AND (
    token = '8ko/R5uFxF87EHyUwkFkfTnmCurpppRHF2CivM1niME=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00056