UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kSip7UXexUQN23LGDxUywcIUUI/hf43KVjMGT1xtFY0=' 
WHERE 
  key_id = '58ea05cfe6fb489b4e7500412977656074e3b959d09226667cb82b3c7118ca75' 
  AND (
    token = 'kSip7UXexUQN23LGDxUywcIUUI/hf43KVjMGT1xtFY0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00071