UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NSguqb7aDpMY+IlgJCJ4ow+mLkJBLpAtwiYSmhujRDQ=' 
WHERE 
  key_id = '82ea0a45edf0d0e172bb179e262b1cc46986fde5b6ef62bcd298dac1c14a1bfc' 
  AND (
    token = 'NSguqb7aDpMY+IlgJCJ4ow+mLkJBLpAtwiYSmhujRDQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040