UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IPk+Vx3bmXxEs3wjmvlWWVDjHBO6mQeTYguRM37z29w=' 
WHERE 
  key_id = '08eeddef10b45c909854b964a5e7a58a99061480a7701a18ad66c229fc21446a' 
  AND (
    token = 'IPk+Vx3bmXxEs3wjmvlWWVDjHBO6mQeTYguRM37z29w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051