UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'zSY6CMsa5siHM6tOOl1olFrAhTrt5Y6V+xmPVAoyiJo=' 
WHERE 
  key_id = '61efa4891252732425d2becca4aea191f6f7aa92c845804b80fe8850cf902206' 
  AND (
    token = 'zSY6CMsa5siHM6tOOl1olFrAhTrt5Y6V+xmPVAoyiJo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040