UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fudkVjAxbhkp2MnwXGMfU64A65JZECyN87R/V6OueTE=' 
WHERE 
  key_id = '0a12d857170e02afb0df068b293a41fc713d09f242a20daafe4233c83f2de062' 
  AND (
    token = 'fudkVjAxbhkp2MnwXGMfU64A65JZECyN87R/V6OueTE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029