UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'B9SeegOCpMf0+dKZFmvyVkjbunH02veztsxcZLbfxRc=' 
WHERE 
  key_id = '1736db1d883ee0d5c0a646b55b119bd3b27039aca6987cc63c15b171c0b72c15' 
  AND (
    token = 'B9SeegOCpMf0+dKZFmvyVkjbunH02veztsxcZLbfxRc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032