UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sZG9C7vC+OjgPt68aEYlKQOiDoce1jnq6ogt6oyP6oM=' 
WHERE 
  key_id = 'c0d1f55ce48ef31a8f86446b365e1d1d71d741cff453ac96b29da11c2cbddfdf' 
  AND (
    token = 'sZG9C7vC+OjgPt68aEYlKQOiDoce1jnq6ogt6oyP6oM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031